<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
</head>
<body>
    <div id='app'>
        <router-link to="/login" tag="div">登录</router-link>
        <router-link to="/register">注册</router-link>
        <router-view></router-view>
        
    </div>
    
    <script>
        const login={
            template:`<div>登录组件</div>`
        }
        const register={
            template:`<div>注册组件</div>`
        }
        const router=new VueRouter({
            routes:[{
                    path: '/',
                    redirect: '/register'
                },{
                path:'/login',
                component:login
            },{
                path:'/register',
                component:register
            }]
        })


    const vm = new Vue({
        el: '#app',
        data: {
        },
        router:router
    })
    </script>
</body>
</html>